{% extends "template/addEdit.volt" %}

{% block title %}新建密钥{% endblock %}

{% block content %}
    <table>
        <tr>
            <th>证书类型:</th>
            <td><select name="type">
                    <option value="">请选择</option>
                    <option value="1">混合证书</option>
                    <option value="0">无限期</option>
                </select></td>
        </tr>
        <tr>
            <th>试用过期时间:</th>
            <td><input type="text" data-attr="date" name="expired_at"/></td>
        </tr>
        <tr>
            <th>试用公里数:</th>
            <td><input type="text" value="" name="kilomter"/></td>
        </tr>
        <tr>
            <th>图像处理:</th>
            <td><select name="smart_map">
                    <option value="">请选择</option>
                    <option value="1">可用</option>
                    <option value="2">不可用</option>
                </select></td>
        </tr>
    </table>
    <table>
        <tr>
            <th>证书:</th>
            <td><textarea type="text" name="key_data" data-valid="presence"></textarea></td>
        </tr>
        <tr>
            <th>证书更新时间:</th>
            <td><input type="text" data-attr="date" name="created_at"/></td>
        </tr>
        <tr>
            <th>起始公里数:</th>
            <td><input type="text" value="" name="begin_kilometer"/></td>
        </tr>
        <tr>
            <th>ipad授权过的钥匙id:</th>
            <td><input type="text" value="" name="key_id"/></td>
        </tr>
    </table>
{% endblock %}
{% block jscontent %}
    <script>
        function addAction(){
            if (DataValidBinder.valid()){
                var params = "action_key=ACTION_ADD&" + $("form").serialize();
                $.post("/plane/addKey", params, function (result){
                    if(result){
                        FAlert(result.message,function(){
                            if (result.status == 0){
                                location.reload();
                            }
                        });
                    }else{
                        FAlert("添加失败");
                    }
                });
            }
        }
    </script>

{% endblock %}